/**
 * MineAdmin is committed to providing solutions for quickly building web applications
 * Please view the LICENSE file that was distributed with this source code,
 * For the full copyright and license information.
 * Thank you very much for using MineAdmin.
 *
 * @Author X.Mo<root@imoi.cn>
 * @Link   https://github.com/mineadmin
 */
import type { MaFormItem } from "@mineadmin/form";
import hasAuth from "@/utils/permission/hasAuth.ts";
import MaDictSelect from "@/components/ma-dict-picker/ma-dict-select.vue";
import MaDictRadio from "@/components/ma-dict-picker/ma-dict-radio.vue";
import userStatus from "$/attractions/attraction-management/views/attractionUser/data/common.tsx";
import { concat } from "lodash-es";
import MaUploadImage from "@/components/ma-upload-image/index.vue";

export default function getFormItems(
  formType: "add" | "edit" = "add",
  t: any,
  model: any
): MaFormItem[] {
  return concat([
    {
      label: "用户昵称",
      prop: "username",
      render: "input",
      renderProps: {
        placeholder: t("form.pleaseInput", { msg: "用户昵称" }),
      },
    },
    {
      label: "用户头像",
      prop: "avatar",
      render: () => MaUploadImage,
      renderProps: {
        placeholder: t("form.pleaseInput", { msg: "用户头像" }),
      },
      multiple: false,
    },
    {
      label: "用户登录次数",
      prop: "times",
      render: "input",
      renderProps: {
        placeholder: t("form.pleaseInput", { msg: "用户登录次数" }),
        disabled: true,
      },
      itemProps: { rules: [{ required: true, message: "请输入用户登录次数" }] },
    },
    {
      label: "微信OpenID",
      prop: "open_id",
      render: () => MaDictSelect,
      renderProps: { multiple: false, disabled: true },
    },
    {
      label: "注册日期",
      prop: "created_at",
      render: "input",
      renderProps: {
        placeholder: t("form.pleaseInput", { msg: "注册日期" }),
        disabled: true,
      },
    },
    {
      label: "用户状态",
      prop: "status",
      render: () => MaDictRadio,
      renderProps: {
        placeholder: t("form.pleaseInput", { msg: "用户状态: 1正常, 2禁用" }),
        data: userStatus,
      },
      itemProps: {
        rules: [{ required: true, message: "请输入用户状态: 1正常, 2禁用" }],
      },
    },
  ]);
}
